package com.book.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.book.bean.Users;
import com.book.biz.UserBiz;
import com.book.biz.impl.UserBizImpl;


public class CheckUserServlet extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		response.setCharacterEncoding("UTF-8");
		PrintWriter out = response.getWriter();
		String user = request.getParameter("user");
		UserBiz uBiz = new UserBizImpl();
		Users users = uBiz.getUsers(user);
		boolean isOk = false;
		if(users!=null){
			isOk = true;
		}
		//响应到客户端
		out.print(isOk);
		out.flush();
		out.close();
	}


	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doGet(request, response);
	}

}
